import { storeToRefs } from "pinia";
import { userStore } from "./user";

/**
 * 注释: 清空token
 *
 * */
export const clearToken = () => {
  const store = storeToRefs(userStore());
  store.token.value = "";
};
/**
 * 注释: 清空所有用户数据
 *
 * */
export const deleteUserInfo = () => {
  const store = userStore();
  store.$state.token = "";
};

/**
 * 注释: 设置token
 *
 * */
export const setToken = (token: string) => {
  const store = storeToRefs(userStore());
  store.token.value = token;
};

/**
 * 注释: 导出token
 *
 * */
export const getToken = () => {
  return userStore().$state.token;
};
